<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>供应商类型管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		//删除
		function deleteData() {
			var $id = $("input[name='id']:checked");
			var ids = new Array();
			var j = 0;
			if ($id.val() != null && $id.val() != '') {
				var submit = function (v, h, f) {
				    if (v == 'ok'){
				        $id.each(function(i, info) {
							ids[j] = info.value;
							j++;
						});
				        resetTip();
						location.href = "${ctx}/pro/supplierType/deleteData?ids="+ ids;
				    }else if (v == 'cancel'){
				    	return true;
				    }
				};
				$.jBox.confirm("确认删除此信息吗？", "提示", submit);
			}else{
				jBox.tip("请勾选需要删除的数据！");
			}
	}
		$(document).ready(function() {	
		//全选
		$("#checkAll").click(function() {
					$('input[name="id"]').attr("checked",this.checked);
				});
		var $subBox = $("input[name='id']");
		$subBox.click(function() {
					$("#checkAll").attr("checked",$subBox.length == $("input[name='id']:checked").length ? true : false);
		});
		});

	</script>
</head>
<body class="fixed-top">
	<div class="container" style="width: 100%;">
		<div style="margin: 20px; border: 1px solid #c8d1d5;">
			<div
				style="padding: 13px; background-color: #f4f4f4; border-bottom: 1px solid #c8d1d5;">
				<h4>
					<i class="icon-globe"></i>供应商类型管理
				</h4>
				<ul class="ul-form" style="float: right; margin-top: -25px;">
					<li style="list-style: none"><a class="btn btn-primary"
						href="${ctx}/pro/supplierType/form"> <i class="icon-pencil"></i>&nbsp;新增
					</a> <a class="btn btn-danger" href="javascript:void(0)"
						onclick="deleteData()"> <i class="icon-trash"></i>&nbsp;删除
					</a></li>
				</ul>
			</div>
			<div style="margin: 17px;">
				<form:form id="searchForm" modelAttribute="supplierType"
					action="${ctx}/pro/supplierType/list" method="post"
					class="breadcrumb form-search">
					<input id="pageNo" name="pageNo" type="hidden"
						value="${page.pageNo}" />
					<input id="pageSize" name="pageSize" type="hidden"
						value="${page.pageSize}" />
					<ul class="ul-form">
						<li>
						<label style="width: 130px;">供应商类型编号：</label> <form:input path="codeNum"
								htmlEscape="false" maxlength="64" class="input-medium" />
						<label>供应商类型：</label> <form:input path="name"
								htmlEscape="false" maxlength="64" class="input-medium" /></li>
						<li class="btns"><input id="btnSubmit"
							class="btn btn-primary" type="submit" value="查询" /></li>
						<li class="clearfix"></li>
					</ul>
				</form:form>
				<sys:message content="${message}" />
					<table id="contentTable"
						class="table table-hover table-bordered" style="word-wrap:break-all;word-break:break-all;">
						<thead>
							<tr><th style="width: 8px;"><input type="checkbox"
								class="group-checkable" id="checkAll" /></th>
								<th>供应商类型编号</th>
								<th>供应商类型</th>
								<th>备注信息</th>
								<th>更新时间</th>
								<shiro:hasPermission name="pro:supplierType:edit">
									<th>操作</th>
								</shiro:hasPermission>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${page.list}" var="supplierType">
								<tr><td style="width: 8px;"><input type="checkbox" name="id"
									class="group-checkable" value="${supplierType.id}" /></td>
									<td>${supplierType.codeNum}</td>
									<td>${supplierType.name}</td>
									<td>${supplierType.remarks}</td>
									<td><fmt:formatDate value="${supplierType.updateDate}"
											pattern="yyyy-MM-dd HH:mm:ss" /></td>
									<shiro:hasPermission name="pro:supplierType:edit">
										<td><a
											href="${ctx}/pro/supplierType/form?id=${supplierType.id}"><i
												class="icon-edit"></i></a> <a
											href="${ctx}/pro/supplierType/deleteData?ids=${supplierType.id}"
											onclick="return confirmx('确认要删除该供应商的类型吗？', this.href)"><i
												class="icon-remove"></i></a></td>
									</shiro:hasPermission>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<div class="pagination">${page}</div>
			</div>
		</div>
	</div>
</body>
</html>